package com.liu.frame.adapter;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.liu.frame.R;
import com.liu.frame.base.BaseRecyclerViewAdapter;
import com.liu.frame.base.BaseViewHolder;
import com.liu.frame.beans.ProductBean;
import com.liu.frame.utils.LogUtils;

import java.util.List;

/**
 * Created by 刘智强 on 2017/2/14.
 */

public class ProductAdapter extends BaseRecyclerViewAdapter<ProductBean> {
    public ProductAdapter(Context context, List<ProductBean> datas, int layoutId) {
        super(context, datas, layoutId);
    }

    @Override
    protected void bindData(BaseViewHolder holder, ProductBean data, final int position) {
        View rootView=holder.getRootView();

        TextView tv_name = holder.getView(R.id.tv_name);
        TextView tv_content = holder.getView(R.id.tv_content);
        if (data != null) {
            holder.setText(R.id.tv_name,data.getName());
            holder.setText(R.id.tv_content,data.getScript());
//            tv_name.setText(data.getName());
//            tv_content.setText(data.getScript());
        }
        holder.setOnClickListener(R.id.rootview, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onItemClickListner.onItemClickListner(v,position);
            }
        });
//        rootView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                onItemClickListner.onItemClickListner(v,position);
//
//            }
//        });
    }


}
